package com.wang.application;

import org.apache.catalina.LifecycleException;
import org.apache.catalina.startup.Tomcat;

import javax.servlet.ServletException;
import java.io.File;

/**
 * Created by wangq on 2021/8/4.
 */
public class SpringApplication {
    public static void run() throws ServletException, LifecycleException {
        System.out.println("tomcat 启动开始...");
        Tomcat tomcat = new Tomcat();
        tomcat.setPort(8080);
        tomcat.addWebapp("/",new File("src/main").getAbsolutePath());
        tomcat.start();
        System.out.println("tomcat 启动完成...");
        tomcat.getServer().await();
    }
}
